package org.dromara.web.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.Operation;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.dao.business.enums.SettingKeys;
import org.dromara.web.domain.app.AppSettingVO;
import org.dromara.web.service.business.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;


@RestController
@RequestMapping("/app/settings")
public class AppSettingsController extends BaseController {

    @Autowired
    SettingsService settingsService;

    /**
     * 系统设置
     *
     * @return
     */
    @Operation
    @SaIgnore
    @GetMapping("/all")
    public R<AppSettingVO> settingsMap() {
        Map<String,String> map = settingsService.getSettingsMap();
        AppSettingVO vo = new AppSettingVO();
        vo.setPrivacyUrl(map.get(SettingKeys.COMMON_PRIVACY_URL));
        vo.setServiceUrl(map.get(SettingKeys.COMMON_SERVICE_URL));
        return R.ok(vo);
    }
}
